package com.ucode.tool.tree;

import java.util.ArrayList;
import java.util.List;

import cn.hutool.json.JSONUtil;

public class NodeTest {

	public static void main(String[] args) {
		List<TreeNode> list = new ArrayList<>();
		list.add(new TreeNode(1L, 0L, "1"));
		list.add(new TreeNode(2L, 0L, "2"));
		list.add(new TreeNode(3L, 1L, "3"));
		list.add(new TreeNode(4L, 2L, "4"));
		list.add(new TreeNode(5L, 3L, "5"));
		list.add(new TreeNode(6L, 4L, "6"));
		list.add(new TreeNode(7L, 3L, "7"));
		list.add(new TreeNode(8L, 5L, "8"));
		list.add(new TreeNode(9L, 6L, "9"));
		list.add(new TreeNode(10L, 9L, "10"));
		
		list.add(new TreeNode(11L, 8L, "10"));
		list.add(new TreeNode(12L, 8L, "10"));
		List<TreeNode> tns = ForestNodeMerger.merge(list);
		JSONUtil.toJsonStr(tns);
		tns.forEach(node ->
			System.out.println(JSONUtil.toJsonStr(node))
		);
	}

}